package com.example.myapplication.Tool;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class TimestampTool {//时间转换工具类
    public static String timestampToDateTime(String timestampString) {
        try {
            long timestamp = Long.parseLong(timestampString);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
            Date date = new Date(timestamp);
            return sdf.format(date);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            return "";
        }
    }
}
